package org.dromara.common.translation.core.impl

import org.dromara.common.core.service.UserService
import org.dromara.common.translation.annotation.TranslationType
import org.dromara.common.translation.constant.TransConstant
import org.dromara.common.translation.core.TranslationInterface

/**
 * 用户名翻译实现
 *
 * @author LikeYouDo
 * @date 2025/07/26
 */
@TranslationType(type = TransConstant.USER_ID_TO_NAME)
class UserNameTranslationImpl(
    private val userService: UserService
) : TranslationInterface<String> {
    override fun translation(key: Any, other: String?): String? {
        if (key is Long) {
            return userService.selectUserNameById(key)
        }
        return null
    }
}
